#pragma once

class Logger
{
public:
	enum LOG_LEVEL
	{
		LOG_LEVEL_DEBUG,
		LOG_LEVEL_WARNING,
		LOG_LEVEL_ERROR
	};

public:
	Logger();
	~Logger();

	static int32_t Init(const std::string& logfile = "./logger.log");

	static int32_t Release();

	static void Log(const LOG_LEVEL level, char* func, const int32_t line, const char* module, int32_t error,  char* format, ...);
};

#ifndef INIT_LOG
#define INIT_LOG(path) Logger::Init(path)
#endif

#ifndef RELEASE_LOG
#define RELEASE_LOG() Logger::Release()
#endif

#ifndef LOG_DEBUG
#define LOG_DEBUG(module, error, format, ...) Logger::Log(Logger::LOG_LEVEL_DEBUG, __FUNCTION__, __LINE__, module, error, format, __VA_ARGS__)
#endif

#ifndef LOG_WARNING
#define LOG_WARNING(module, error, format, ...) Logger::Log(Logger::LOG_LEVEL_WARNING, __FUNCTION__, __LINE__, module, error, format, __VA_ARGS__)
#endif

#ifndef LOG_ERROR
#define LOG_ERROR(module, error, format, ...) Logger::Log(Logger::LOG_LEVEL_ERROR, __FUNCTION__, __LINE__, module, error, format, __VA_ARGS__)
#endif
